/*
 * Copyright 2013 Agustina Martinez-Garcia

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */
package uk.ljmu.qudexapps.xmllib.model;

import java.util.HashMap;
import java.util.Map;
import org.apache.poi.hssf.usermodel.HSSFCell;

import uk.ljmu.qudexapps.xmllib.utilities.SpreadsheetUtilities.Column;
/**
 * Class to manages a Map of Spreadsheet Columns - associated cells values
 * @author agustinamartinez
 *
 */
public class ColumnMap 
{
	/**
	 * Row identifier
	 */
	private String identifier;
	/**
	 * Array of cells associated with a particular column
	 */
	private Map<Column, ?> columnMap;
	
	/**
	 * @param columnMap the column map structures to set
	 */
	public void setColumnMap(Map<Column, ?> columnMap) {
		this.columnMap = columnMap;
	}

	/**
	 * @return the columnMap
	 */
	public Map<Column, ?> getColumnMap() {
		return columnMap;
	}

	/**
	 * @param identifier the identifier to set
	 */
	public void setIdentifier(String identifier) {
		this.identifier = identifier;
	}

	/**
	 * @return the identifier
	 */
	public String getIdentifier() {
		return identifier;
	}

	/**
	 * Custom constructor specify type of element in the map
	 * i.e. XLS HSSFCell, CSV String
	 * @param classType String containing the name of the class of the map element
	 */
	public ColumnMap(String classType)
	{
		if (classType.equalsIgnoreCase("java.lang.String"))
			this.setColumnMap(new HashMap<Column, String>());
		else if (classType.equalsIgnoreCase("org.apache.poi.hssf.usermodel.HSSFCell")) 
			this.setColumnMap(new HashMap<Column, HSSFCell>());	
	}
}
